from typing import List
from pydantic import Field, BaseModel, constr


class _SearchScope(BaseModel):
    """平台数据 查询范围"""
    source_ids: List[str] = Field(None, title='数据源id')
    model_ids: List[str] = Field(None, title='模型id')
    range: dict = Field(None, title='时间范围')


class _ElasticsearchScope(BaseModel):
    datasource: str = Field(..., title='es数据源')
    index: str = Field(..., title='es索引')


class _SqlScope(BaseModel):
    datasource: str = Field(..., title='数据库数据源')


class Search(BaseModel):
    """平台的搜索"""
    scope: _SearchScope = Field(..., title='数据源')
